package Example.Connectors;

import java.util.HashMap;
import java.util.Map;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.BindingController;
import org.objectweb.fractal.api.control.IllegalBindingException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import java.util.Vector;
import Example.Interfaces.Bike;
public class BikeCtr implements Bike, BindingController{

private Object service;
private Map bindings = new HashMap();

public String[] listFc () {
return (String[])bindings.keySet().toArray(new String[bindings.size()]);
}

public Object lookupFc (String itf) {
return bindings.get(itf);
}

public void bindFc (String itf, Object value) {
if (!itf.equals("component")) {
bindings.put(itf, value);
}
}

public void unbindFc(String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
System.err.println("unbind");
if(!(bindings.get(clientItfName)==null))
bindings.remove(clientItfName);
}
public Vector findBike(String a1,String a2){
return ((Bike) service).findBike( a1, a2);
}

public boolean rentB(int a1,int a2){
return ((Bike) service).rentB( a1, a2);
}

public double returnB(int a1,int a2,String a3,double a4){
return ((Bike) service).returnB( a1, a2, a3, a4);
}

}
